package com.gee.spring.boot.rpf.client.gaode;

import cn.hutool.json.JSONObject;
import com.gee.spring.boot.rpf.controller.fico.RequestWrapper;
import com.gee.thread.flow.executor.ExecuteContext;
import com.gee.thread.flow.translator.V2PTranslator;
import org.springframework.stereotype.Component;

/**
 * desc:
 *
 * @author gee wrote on  2021-02-03 17:07:12
 */
@Component
public class GaoDeRequestInitializer implements V2PTranslator<RequestWrapper, GaoDeRequest> {

    @Override
    public GaoDeRequest translate(String preWorkId, ExecuteContext<RequestWrapper> executeContext) {
        GaoDeRequest request = new GaoDeRequest();
        JSONObject variable = executeContext.getVariable().getRequest();
        request.setAddress(variable.get("companyAddr", String.class));
        return request;
    }
}
